package com.sooncode.project.focusservice.model;

import com.sooncode.project.core.annotations.Lookup;
import com.sooncode.project.core.annotations.LookupModel;
import com.sooncode.project.focusservice._.base.BaseDomainModel;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

@Data
@LookupModel
public class Course extends BaseDomainModel<Course> {
    private String name;
    private String status;
    private String testType;
    private Double difficulty=0.0;
    private String latitudeId;
    @Lookup(fromModel = CourseLatitude.class,localField = "latitudeId",fromField = "name")
    private String latitudeName;
    private String subjectsId;
    @Lookup(fromModel = CourseSubjects.class,localField = "subjectsId",fromField = "name")
    private String subjectsName;
    private String typeId;
    @Lookup(fromModel = CourseType.class,localField = "typeId",fromField = "name")
    private String typeName;
    private String joinName;
    private String[] measure;
    private List<CourseFile> files;
    public String getJoinName() {
        if(StringUtils.isEmpty(typeName))
            return name;
        else
            return typeName+"："+name;
    }
}
